import request from '@/config/axios'
/**
 * 根据账号获取文件夹信息
 */
export const getFolderByAccountIds = (accountIds) => {
  return request.get({ url: '/mailbox/mail/get-folder-by-account-ids?accountIds=' + accountIds })
}

/**
 * 新增邮件文件夹
 */
export const createFolder = (data) => {
  return request.post({ url: '/mailbox/mail/create-folder', data })
}

/**
 * 更新邮箱文件夹
 */
export const updateFolder = (data) => {
  return request.put({ url: '/mailbox/mail/update-folder', data })
}

/**
 * 删除文件夹
 */
export const deleteFolder = (id) => {
  return request.delete({ url: '/mailbox/mail/delete-folder?id=' + id })
}

/**
 * 查询邮件标签
 */
export const listLabel = (ownerId) => {
  return request.get({ url: '/mailbox/mail/list-label?ownerId=' + ownerId })
}

/**
 * 新增邮件标签
 */
export const createLabel = (data) => {
  return request.post({ url: '/mailbox/mail/create-label', data })
}

/**
 * 更新邮件标签
 */
export const updateLabel = (data) => {
  return request.put({ url: '/mailbox/mail/update-label', data })
}

/**
 * 获取单个标签
 */
export const singleGetLabel = (id) => {
  return request.get({ url: '/mailbox/mail/single-get-label?id=' + id })
}

/**
 * 标签排序
 */
export const labelSort = (data) => {
  return request.post({ url: '/mailbox/mail/label-sort', data })
}

/**
 * 删除标签
 */
export const deleteLabel = (id) => {
  return request.delete({ url: '/mailbox/mail/delete-label?id=' + id })
}

/**
 * 获取未读的置顶邮件数量
 */
export const getUnreadTopMail = (accountIds) => {
  return request.get({ url: '/mailbox/mail/get-unread-top-mail?accountIds=' + accountIds })
}

/**
 * 根据文件夹ID获取邮件信息
 */
export const pageMail = (params) => {
  return request.get({ url: '/mailbox/mail/page-mail', params })
}

/**
 * 设置邮件是否已读
 */
export const setMailRead = (data) => {
  return request.post({ url: '/mailbox/mail/set-mail-read', data })
}

/**
 * 设置邮件是否置顶
 */
export const setMailTop = (data) => {
  return request.post({ url: '/mailbox/mail/set-mail-top', data })
}

/**
 * 设置邮件标签
 */
export const setMailLabel = (data) => {
  return request.post({ url: '/mailbox/mail/set-mail-label', data })
}

/**
 * 邮件移动文件夹
 */
export const moveFolder = (data) => {
  return request.post({ url: '/mailbox/mail/move-folder', data })
}

/**
 * 设置邮件是否是垃圾邮件
 */
export const setMailJunk = (data) => {
  return request.post({ url: '/mailbox/mail/set-mail-junk', data })
}

/**
 * 删除邮件
 */
export const deleteMail = (mailIds) => {
  return request.delete({ url: '/mailbox/mail/delete-mail?mailIds=' + mailIds })
}

/**
 * 获取邮件详情
 */
export const getMailDetail = (id) => {
  return request.get({ url: '/mailbox/mail/get-mail-detail?id=' + id })
}

/**
 * 设置文件夹下全部邮件为已读
 */
export const setFolderAllMailRead = (id) => {
  return request.post({ url: '/mailbox/mail/set-folder-all-mail-read?id=' + id })
}

/**
 * 清除邮件标签
 */
export const clearMailLabel = (data) => {
  return request.post({ url: '/mailbox/mail/clear-mail-label', data })
}

/**
 * 查找收件人
 */
export const receiverMultiQuery = (data) => {
  return request.post({ url: '/mailbox/mail/receiver-multi-query', data })
}

/**
 * 保存或发送邮件
 */
export const saveMail = (data) => {
  return request.post({ url: '/mailbox/mail/save-mail', data })
}

/**
 * 将邮件保存成文件
 */
export const saveMailAsFile = (id) => {
  return request.post({ url: '/mailbox/mail/save-mail-as-file?id=' + id })
}

/**
 * 根据邮件获取客户联系人信息
 */
export const getReceiverByAddresses = (data) => {
  return request.post({ url: '/mailbox/mail/get-receiver-by-addresses', data })
}
